package com.fiberhome.nas.core.model.entity

import android.net.Uri
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import java.util.Date


@Serializable
data class TimeBucketInfo(
    @SerialName("count") val count: Int? = null, //当前时间桶内文件个数
    @SerialName("timeBucket") val timeBucket: String = "", //时间桶, ISO 8601 时间格式
)


/**
 * 照片模型
 */
@Serializable
data class PhotoInfo(
    @SerialName("id") val id: String = "",    //文件ID
    @SerialName("ownerId") val ownerId: String = "",    //拥有者 ID
    @SerialName("type") val type: String = "",    //类型，IMAGE/VIDEO/AUDIO/OTHER
    @SerialName("originalFileName") val originalFileName: String = "",    //原始文件名
    @SerialName("originalMimeType") val originalMimeType: String = "",    //原始文件 MIME 信息
    @SerialName("fileCreatedAt") val fileCreatedAt: String = "",    //文件创建时间戳
    @SerialName("fileModifiedAt") val fileModifiedAt: String = "",    //文件修改时间戳
    @SerialName("updatedAt") val updatedAt: String = "",    //文件更新时间戳
    @SerialName("isFavorite") val isFavorite: Boolean = false,    //是否是收藏
    @SerialName("isTrashed") val isTrashed: String = "",    //是否被删除
    @SerialName("duration") val duration: String = "",    //文件时长
    @SerialName("checksum") val checksum: String = "",    //文件 MD5 校验码
    @SerialName("isOffline") val isOffline: Boolean = false,    //文件本地是否存在
    @SerialName("hasMetadata") val hasMetadata: Boolean = false,  //是否有元数据
    @SerialName("duplicateId") val duplicateId: String = "",    //重复文件 Id
    @SerialName("exifInfo") val exifInfo: ExifInfo = ExifInfo(),   //Exif 信息
) {
}

/**
 * Exif 信息
 */
@Serializable
data class ExifInfo(
    @SerialName("make") val make: String? = null,    //相机制造商
    @SerialName("model") val model: String? = null,   //相机型号
    @SerialName("exifImageWidth") val exifImageWidth: Int? = null,    //图片宽度
    @SerialName("exifImageHeight") val exifImageHeight: Int? = null,    //图片高度
    @SerialName("fileSizeInByte") val fileSizeInByte: Long? = null,    //文件大小
    @SerialName("orientation") val orientation: String? = null,   //图片旋转
    @SerialName("dateTimeOriginal") val dateTimeOriginal: String = "",  //文件原始创建时间
    @SerialName("modifyDate") val modifyDate: String = "",    //文件修改时间
    @SerialName("latitude") val latitude: Double? = null,   //纬度
    @SerialName("longitude") val longitude: Double? = null,     //经度
    @SerialName("city") val city: String? = null,   //城市
    @SerialName("state") val state: String? = null,    //省
    @SerialName("country") val country: String? = null,    //国家
    @SerialName("description") val description: String = ""    //描述
)

/**
 * 媒体类型
 */
enum class MediaType {
    PHOTO, VIDEO, AUDIO, OTHER
}


@Serializable
data class PhotoItem(
    val id: String,
    val date: String,
    val imageResId: Int,
    val url: String = "",
    val isBackedUp: Boolean = false, // 备份状态
    val isFavorite: Boolean = false, // 收藏状态
)


/**
 * 本地媒体项
 */
data class LocalMediaItem(
    val id: Long,
    val uri: Uri,
    val type: MediaType,
    val displayName: String,
    val mimeType: String,
    val dateTaken: Date,
    val duration: Long? = null, // 仅视频有此属性
    val fileSize: Long,
    val width: Int,
    val height: Int,
    val path: String
) {
    fun isUnbackedUp() = false
}




